package br.inf.solutions.apresentacoes.ssp.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import br.com.vexillum.model.CommonEntityActivated;
import br.com.vexillum.model.annotations.SearchField;
import br.com.vexillum.model.annotations.Validate;
import br.com.vexillum.model.annotations.ValidatorClass;
import br.inf.solutions.apresentacoes.ssp.model.basics.CountType;
import br.inf.solutions.apresentacoes.ssp.model.basics.SpeciesRemoval;

@SuppressWarnings("serial")
@ValidatorClass(validatorClass = "br.inf.solutions.apresentacoes.ssp.control.validator.ParametrizationRemovalValidator")
@Entity
@Table(name = "parametrization_removal")
public class ParametrizationRemoval extends CommonEntityActivated{
	
	@Validate(notNull=true)
	@SearchField(introspect=true)
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="species_removal",insertable=true, updatable=true, unique=false)
	private SpeciesRemoval species;
	
	@Validate(notNull=true)
	@Column(name="removal_period",nullable = false, unique = false, updatable = true)
	private Boolean removalPeriod;
	
	@Validate(notNull=true)
	@SearchField(introspect=true)
	@Column(name="law",nullable = false, unique = false, updatable = true, length = 50)
	private String law;
	
	@Validate(notNull=true)
	@Column(name="max_time_removal",nullable = false, unique = false, updatable = true)
	private Integer maxTimeRemoval;
	
	@Validate(notNull=true)
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="type_count_max_time", updatable=true, unique=false, nullable=false)
	private CountType typeCountMaxTime;
	
	@Column(name="max_percent_contingent",nullable = true, unique = false, updatable = true)
	private Integer maxPercent;
	
	@Column(name="time_service_provied",nullable = true, unique = false, updatable = true)
	private Integer timeServiceProvied;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="type_count_time_service", updatable=true, unique=false, nullable=true)
	private CountType typeCountTimeService;
	
	@Validate(notNull=true)
	@Column(name="time_service",nullable = false, unique = false, updatable = true)
	private Boolean timeService;
	
	@Validate(notNull=true)
	@Column(name="initial_date",nullable = false, unique = false, updatable = true)
	private Date initialDate;
	
	@Column(name="final_date",nullable = true, unique = false, updatable = true)
	private Date finalDate;

	public SpeciesRemoval getSpecies() {
		return species;
	}

	public void setSpecies(SpeciesRemoval species) {
		this.species = species;
	}

	public Boolean getRemovalPeriod() {
		return removalPeriod;
	}

	public void setRemovalPeriod(Boolean removalPeriod) {
		this.removalPeriod = removalPeriod;
	}

	public String getLaw() {
		return law;
	}

	public void setLaw(String law) {
		this.law = law;
	}

	public Integer getMaxTimeRemoval() {
		return maxTimeRemoval;
	}

	public void setMaxTimeRemoval(Integer maxTimeRemoval) {
		this.maxTimeRemoval = maxTimeRemoval;
	}

	public CountType getTypeCountMaxTime() {
		return typeCountMaxTime;
	}

	public void setTypeCountMaxTime(CountType typeCountMaxTime) {
		this.typeCountMaxTime = typeCountMaxTime;
	}

	public Integer getMaxPercent() {
		return maxPercent;
	}

	public void setMaxPercent(Integer maxPercent) {
		this.maxPercent = maxPercent;
	}

	public Integer getTimeServiceProvied() {
		return timeServiceProvied;
	}

	public void setTimeServiceProvied(Integer timeServiceProvied) {
		this.timeServiceProvied = timeServiceProvied;
	}

	public CountType getTypeCountTimeService() {
		return typeCountTimeService;
	}

	public void setTypeCountTimeService(CountType typeCountTimeService) {
		this.typeCountTimeService = typeCountTimeService;
	}

	public Boolean getTimeService() {
		return timeService;
	}

	public void setTimeService(Boolean timeService) {
		this.timeService = timeService;
	}

	public Date getInitialDate() {
		return initialDate;
	}
	
	public void setInitialDate(Date initialDate) {
		this.initialDate = initialDate;
	}

	public Date getFinalDate() {
		return finalDate;
	}
	
	public void setFinalDate(Date finalDate) {
		this.finalDate = finalDate;
	}
	
	public void setRemovalPeriod(String a){
		removalPeriod = Boolean.parseBoolean(a);
	}
	
	public void setTimeService(String a){
		timeService = Boolean.parseBoolean(a);
	}
}
